from pyglet import clock

class PygletTimer():
	"""For global access to a timer"""
	def __init__(self):
		self.dt = 0.0
		self.paused = 0
	
	def update(self):
		self.dt = clock.tick()
		if self.dt > 0.2: self.dt = 0
		if self.paused: self.dt = 0
		#if not self.paused: print self.dt
	
	def update(self,dt):
		self.dt=dt
		if self.dt > 0.2: self.dt = 0
		if self.paused: self.dt = 0
	
	def pause(self):
		self.paused = 1
	
	def unpause(self):
		self.paused = 0

timer = PygletTimer()